package com.ss.android.article.base.feature.detail2.widget.tagview;

import android.content.Context;
import android.content.res.Resources;
import android.util.AttributeSet;
import android.view.View;
import android.widget.TextView;
import com.bytedance.common.utility.UIUtils;
import com.ss.android.article.base.app.AppData;

import im.quar.autolayout.utils.AutoUtils;

public class TagLayout extends FlowLayout {
    public TagLayout(Context arg1) {
        super(arg1);
    }

    public TagLayout(Context arg1, AttributeSet arg2) {
        super(arg1, arg2);
    }

    public TagLayout(Context arg1, AttributeSet arg2, int arg3) {
        super(arg1, arg2, arg3);
    }

    public static TextView a(Context arg4, String arg5) {
        TextView v0 = new TextView(arg4);
        v0.setText(((CharSequence)arg5));
        v0.setTextSize(14f);
        v0.setGravity(17);
        v0.setPadding(AutoUtils.scaleValue(30), 0, AutoUtils.scaleValue(30), 0);
        v0.setLayoutParams(new LayoutParams(((int) UIUtils.dp2px(arg4, 28f))));
        return v0;
    }

    public final void a(View arg2, View.OnClickListener arg3) {
        this.addView(arg2);
        if((arg2 instanceof TextView)) {
            this.a((TextView) arg2);
        }

        arg2.setOnClickListener(arg3);
    }

    public final void a() {
        int v2 = this.getChildCount();
        int v1;
        for(v1 = 0; v1 < v2; ++v1) {
            View v0 = this.getChildAt(v1);
            if((v0 instanceof TextView)) {
                this.a(((TextView)v0));
            }
        }
    }

    private void a(TextView arg3) {
        Resources v0 = this.getResources();
        AppData.getInstance();
        AppData.isNightMode();
        arg3.setTextColor(v0.getColorStateList(com.ss.android.article.browser.R.color.ssxinzi2_selector));
        arg3.setBackgroundDrawable(this.getResources().getDrawable(com.ss.android.article.browser.R.drawable.jg));
    }
}

